<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width='device-width', initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
       <ul>
           <li v-for="(film,index) in films" :key="film.filmId">
               <h2> {{ film.name }} </h2>
           </li>
       </ul>
    </div>
    <script src="./vue.js"></script>
    <script src="./axios.js"></script>
    <script>
        // 通过axios创建一个实例
        // 允许 做初始化配置
        const request = axios.create({
            baseURL: 'https://m.maizuo.com',
            timeout: 5000,
            headers: {
                "X-Client-Info":`{"a":"3000","ch":"1002","v":"5.0.4","e":"1595903073147918673674241"}
`,
                "X-Host": "mall.film-ticket.film.list" 
            }
        })
        let vm = new Vue({
            el:"#app",
            data:{
                films:[]
            },
            created(){
                this.fetchData();
            },
            methods:{
                fetchData(){
                    request.get("/gateway",{
                        params:{
                            cityId:440300,
                            pageNum:1,
                            pageSize:10,
                            type:1,
                            k:2114967
                        }
                    }).then(res=>{
                        console.log(res)
                    })
                }
            }
        })
    </script>
</body>
</html>